﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ERPStudio;
using System.Data.SqlClient;

namespace ResUma
{
    public partial class TipRetineriFrm : FrmCard
    {
        public TipRetineriFrm(ModuleClass mc)
            : base(mc)
        {
            InitializeComponent();
            workConnString = "ESRPConnectionString";
            categorieBindingSource.List.Add(new FormatTipSpor("Avans", "A"));
            categorieBindingSource.List.Add(new FormatTipSpor("Tip", "T"));
            categorieBindingSource.List.Add(new FormatTipSpor("Pensie", "P"));
            categorieBindingSource.List.Add(new FormatTipSpor("Buget", "B"));

            tipBindingSource.List.Add(new FormatTipSpor("Avans", "A"));
            tipBindingSource.List.Add(new FormatTipSpor("Maxim", "M"));
            tipBindingSource.List.Add(new FormatTipSpor("Suma", "S"));
            tipBindingSource.List.Add(new FormatTipSpor("Procent", "P"));


            bazaAplicareBindingSource.List.Add(new FormatTipSpor("Salar Net", "N"));
            bazaAplicareBindingSource.List.Add(new FormatTipSpor("Salar Initial", "I"));

            sursaRetinereBindingSource.List.Add(new FormatTipSpor("Salar Net", "N"));
            sursaRetinereBindingSource.List.Add(new FormatTipSpor("Salar Brut", "B"));
            sursaRetinereBindingSource.List.Add(new FormatTipSpor("Avans", "A"));

           
            /*dataDefinireDTP.Format = DateTimePickerFormat.Custom;
            dataDefinireDTP.CustomFormat = Application.CurrentCulture.DateTimeFormat.ShortDatePattern;*/
            HandleRezumat += new EventHandler(TipSporuriFrm_HandleRezumat);
        }

        void TipSporuriFrm_HandleRezumat(object sender, EventArgs e)
        {
            /*TipSporuriRezFrm frm = new TipSporuriRezFrm(ModuleInfo, tipSporBindingSource);
            frm.MdiParent = this.MdiParent;
            frm.Show();
            _CloseFormList.Add(frm);*/
        }

        private void TipSporuriFrm_Load(object sender, EventArgs e)
        {
            SqlConnection con = DeschideConexiune(workConnString);
            tipRetinereTableAdapter.Connection = con;
            this.tipRetinereTableAdapter.Fill(this.eSRPDataSet.TipRetinere);
            InchideConexiune(con);
            this.listBndSourceMain.Add(tipRetinereBindingSource);
            listTableAdaptor.Add(tipRetinereTableAdapter.Adapter);

        }

        
        /*private void formatCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (formatCB.SelectedValue == null)
                return;
            GrilaL.Visible = formatCB.SelectedValue.ToString() == "G";
            valoareNUD.Enabled = (formatCB.SelectedValue.ToString()!="G" && formatCB.SelectedValue.ToString()!="F");
            GrileOcupatiiLL.Visible = formatCB.SelectedValue.ToString() == "F";
            GrileOcupatiiDepLL.Visible = formatCB.SelectedValue.ToString() == "D";
        }

        private void GrilaL_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (tipSporBindingSource.Current == null)
                return;
            if (((DataRowView)tipSporBindingSource.Current).IsNew)
            {
                MessageBox.Show("Va rugam salvati tipul de spor inainte de a definii grila!");
                return;
            }
            ESRPDataSet.TipSporRow rdsp = ((DataRowView)tipSporBindingSource.Current).Row as ESRPDataSet.TipSporRow;
            GrilaFrm frm = new GrilaFrm(ModuleInfo, rdsp.IdTipSpor);
            frm.ShowDialog();
        }

        private void GrileOcupatiiLL_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (tipSporBindingSource.Current == null)
                return;
            if (((DataRowView)tipSporBindingSource.Current).IsNew)
            {
                MessageBox.Show("Va rugam salvati tipul de spor inainte de a definii grila!");
                return;
            }
            ESRPDataSet.TipSporRow rdsp = ((DataRowView)tipSporBindingSource.Current).Row as ESRPDataSet.TipSporRow;
            GrilaOcupatiiFrm frm = new GrilaOcupatiiFrm(ModuleInfo, rdsp.IdTipSpor);
            frm.ShowDialog();
        }

        private void GrileOcupatiiDepLL_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (tipSporBindingSource.Current == null)
                return;
            if (((DataRowView)tipSporBindingSource.Current).IsNew)
            {
                MessageBox.Show("Va rugam salvati tipul de spor inainte de a definii grila!");
                return;
            }
            ESRPDataSet.TipSporRow rdsp = ((DataRowView)tipSporBindingSource.Current).Row as ESRPDataSet.TipSporRow;
            GrilaOcupatiiDepFrm frm = new GrilaOcupatiiDepFrm(ModuleInfo, rdsp.IdTipSpor);
            frm.ShowDialog();
        }*/
    }

}
